Repository navigation
fix(lint)!: os build and the object_extension publish door judge each validation rule an object extension adds by the object's own rule pass - #33205
Conversation
…extension adds, by the object walk's own rule pass WIP: pins, changeset and migration entry follow. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibyToDkPxCjvNiWsv6e
… the object_extension gate and the real publish door Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibyToDkPxCjvNiWsv6e
…ild and the object_extension door Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibyToDkPxCjvNiWsv6e
…s a rule declared on the object must Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibyToDkPxCjvNiWsv6e
…; the extension rule loop adds no receiver Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibyToDkPxCjvNiWsv6e
…its nullable operand Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibyToDkPxCjvNiWsv6e
…now meets, and its fix Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibyToDkPxCjvNiWsv6e
…-mn9za6 # Conflicts: # packages/lint/src/authored-site-expression.test.ts
📓 Docs Drift CheckThis PR changes 2 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 172 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin d6c1cf20d4112e29732a134f1516f35025bf7d15 && git checkout d6c1cf20d4112e29732a134f1516f35025bf7d15
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 6e1ab9b286655c5476312ae563ab531f3f36cf38 9d07ffa069baf93055b4da43e19fccbf9237159c && git checkout -B drift-repro 6e1ab9b286655c5476312ae563ab531f3f36cf38 && git merge --no-ff 9d07ffa069baf93055b4da43e19fccbf9237159c
node scripts/docs-audit/affected-docs.mjs --json 6e1ab9b286655c5476312ae563ab531f3f36cf38
|
|
domain:spec#2 · os-tesla · session_01L9qibvfX5bawZKtfa6u7j9 Contract-review-claim: session_01L9qibvfX5bawZKtfa6u7j9 · head 15d0747 · 2026-11-14T03:07Z Face: schema + narrowing ( Generated by Claude Code |
|
domain:spec#2 · os-tesla · session_01L9qibvfX5bawZKtfa6u7j9 Contract reviewServed-tier: PR #33205 for card #33154, on the schema face (the semantic entry) and the declared narrowing. Read: the card body and its five comments (6865785642, 6868572380, 6868654518, 6869487624, 6870691534), the PR body and its nine-path file list, the net diff against One must-fix (F1), one should-fix (F2), three nits (N1 to N3). ① Derived judgments
② Semver levelThe changeset moves The ③ Boundary flags
④ Design judgmentWhat was tried against the design, and held:
The hoist is faithful (① item 7). The extension loop passes the target, the entry locator and the rule's key path, and the return after the walk is intact. Two findings on the contract, two nits. F1, must-fix. At the real
F2, should-fix. A one-hop read through a reference field an extension adds has its leaf unjudged, so the card's trap stays open in that corner.
N1, nit. The key path's index is a counter over N2, nit. The comment at N3, nit, in the
Fix both with F1's edit to the entry, or leave them as accepted deviations.
Comment only, as amended. Its measured sentence holds on reading: The four test files (implementing)
Outside the diff, read only: the Implemented-by: VERDICT: FAIL Generated by Claude Code |
…columns The object_extension door hands the objects as the registry serves them, with the injected system columns (created_at, owner_id, ...) declared, so the null-guard gate judged record.created_at as a declared nullable field and refused an extension rule os build accepts. On that write each object is now read through stripInjectedSystemColumns, as the authored-site expression judge does. Pinned at the gate and the real door (accepted at both; a declared nullable field still refused at both). Comments, the changeset and the semantic entry now say that the leaf of a one-hop read through an extension-added reference is not judged, that the door's 422 keeps the stack path, that os lint narrows too, and that the null-guard gate judges ordering and arithmetic operands only. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibyToDkPxCjvNiWsv6e
|
domain:spec#2 · os-tesla · session_01L9qibvfX5bawZKtfa6u7j9 Contract-review-hold: session_01L9qibvfX5bawZKtfa6u7j9 · head 9d07ffa · the maintainer paused lane seats' own contract reviews; reviews go to the new review agent · until a review agent is seated and takes this head Handover · PR #33205 (card #33154) · 2026-11-14T04:39ZThe seat signs off by the maintainer's instruction. The PR stays a draft and is not accepted. Nothing is armed.
Generated by Claude Code |
|
domain:spec#2 · os-tesla · session_01L9qibyToDkPxCjvNiWsv6e Contract-review-claim: session_01L9qibyToDkPxCjvNiWsv6e · head 9d07ffa · 2026-11-14T14:19Z Face: schema + narrowing ( Generated by Claude Code |
|
domain:spec#2 · os-tesla · session_01L9qibyToDkPxCjvNiWsv6e Re-run, once: Generated by Claude Code |
|
domain:spec#2 · os-tesla · session_01L9qibyToDkPxCjvNiWsv6e The brief handed to the isolated reviewer at Contract review brief — PR #33205 @
|
|
domain:spec#2 · os-tesla · session_01L9qibyToDkPxCjvNiWsv6e Contract reviewServed-tier: PR #33205 for card #33154, on the schema face (the semantic entry) and the declared narrowing. This is a full review of the rework head. It also judges, finding by finding, whether F1, F2, N2 and N3 of the earlier record 6870963898 (head Read: the card body and its six comments; the PR body, its nine-path file list and its six comments (the earlier record, the hand-over 6871853372, the two claims and the re-run note among them); the net diff against No must-fix and no should-fix. Four nits (N4 to N7). One follow-up card is owed (the flow and hook doors, under ③). Check-runs at 2026-11-14T14:28Z: 71 runs: 58 success, 12 skipped, 1 in progress. The one without a conclusion is ① Derived judgments
② Semver levelThe changeset moves
③ Boundary flags
④ Design judgmentThe earlier record's findings, judged in the tree at this head.
Read sentence by sentence against the tree.
The code agrees with the contract. The hoist is faithful (① item 7). The extension loop ( Tried against the strip, and held:
N4, nit. N5, nit, in the N6, nit, prose face (changeset). The Now paragraph names one effect of the strip: N7, nit, prose face (PR body). The PR body's
Comment only, as amended. Its measured sentence holds on reading: The four test files (implementing)
Implemented-by: VERDICT: PASS Generated by Claude Code |
|
domain:spec#2 · os-tesla · session_01L9qibyToDkPxCjvNiWsv6e 维护者速读 · PR #33205 @
|
|
domain:spec#2 · sunhaolin · session_017xRBcSbLCxEmyHf9upz3pz 维护者速读 · PR #33205 @
|
…a flow condition (objectstack-ai#33255) Fixes objectstack-ai#33176 Clause-②: yes (widening) — `validate_expression` gains an optional input, `variables`, carrying the flow's declared variables at `site: 'flow_condition'`, so the tool accepts a call it refuses today (`strictToolInput`); with no variables the answer is unchanged. Metadata-protocol: none Skills-docs: follow-up objectstack-ai#33272 ## 维护者速读 - 改了什么:MCP `validate_expression` 在 `flow_condition` 位点新增可选入参 `variables`(流程声明的变量,形状即 spec 的 `FlowVariableSchema`)。给了它,探针流程声明这些变量,运行时流程门禁自己的"变量遮蔽同名字段"告警会回来;共享校验器把这些裸名当变量,不再按字段判类型。 - 为什么改:流程运行时先绑定声明的变量、再平铺记录字段,所以与字段同名的裸名读到的是变量;工具此前拿不到变量,会按字段给出类型判定,也给不出门禁的遮蔽告警,代理保存流程时才看到不同的答案。 - 风险与回滚:只加一个可选入参;不传时每个调用的答案与之前逐字相同(既有 72 个工具级用例不改动即为对照);门禁接受集不变。回滚即 revert 本 PR。 - 先看:`packages/lint/src/authored-site-expression.ts`(`authoredFlowProbe` 声明变量)、`packages/mcp/src/mcp-http-tools.ts`(`variables` 入参、非流程位点拒收、`flowVariables` 提示、`gatePassFindings` 传参)。 - 两分钟验证:`pnpm --filter @objectstack/mcp exec vitest run src/mcp-validate-expression.test.ts`,预期 77 个测试全过,其中 `title * 2 > 10` 带 `variables` 时无类型错误且得到门禁的遮蔽告警,不带时报 `type-mismatch-run-fails`。 - 需要你做的:无,席位落地。 ## What changes **Input shape: an optional `variables` input, not "read from a named served flow".** I chose the input. At a flow condition the tool reads only the subject object's served definition. Reading a named flow would need a new bridge member on both doors (the runtime bridge and the stdio bridge), a permission fence for flow metadata, and an answer for a flow that is not saved yet, which is the usual case while an agent authors one. That is outside this claim's file surface. The input takes the flow's own shape, `z.array(FlowVariableSchema)` from `@objectstack/spec/automation`, so an agent can hand over a flow's `variables` array as it stands. A malformed variable gets the spec's own refusal (a missing `type`, a `$` name, an alias key such as `input`). No new shape is written by hand, which follows the `AggregationNodeSchema` precedent on `aggregate_records`. With `variables` at `site: 'flow_condition'`: - **Gate half.** `gatePassFindings` hands the variables to `judgeAuthoredSiteExpression`, and `authoredFlowProbe` declares them on the one-flow probe. The gate's own walk then runs `warnShadowedFieldReads` on the probe's edge and gives its warning for a variable named like a field of `objectName` that is read bare. ⛔ Nothing is re-implemented: the probe only declares what the flow declares. - **Validator half.** The shared validator gets the names through its existing option `ExprSchemaHint.flowVariables`, the key the gate hands it on the same flow. A bare read of a declared variable is therefore not typed as the field. "Typed as the variable" means what it means at the gate: the bare name stays `dyn`. Neither the gate nor the validator types a variable by its declared `type`, so the tool does not either. - `record.FIELD` still reads the field and is judged as before. Without `variables` nothing changes. The probe carries no `variables` key and the hint carries no `flowVariables` key, so every call answers byte for byte as before. The tool description and the input description say that the shadowed-read warning needs the variables. `variables` on any other site is refused, as `startCondition` is: `` `variables` describes a flow; it applies only with site "flow_condition" ``. **stdio.** Measured: both transports register one tool definition through `wireBridgeTools`, and the stdio bridge already serves `servedObjectDefinitionOf`. So `stdio-data-bridge.ts` needs no change. A parity pin drives a real `StdioServerTransport` and the HTTP door with the same arguments. **Measured against the dispatch's mechanism notes** (on `origin/main` `295ce127`): - The input schema took `objectName, expression, site, severity, triggerKind, sweepObject, startCondition, field`. Holds. - The probe declared no variables. Holds; the module header said so. - Does the validator have an option for extra bindings? Yes: `flowVariables`, names only. It does not type a variable at all, so a bare variable is left untyped rather than typed by the variable's `type`. - Does stdio serve the same definition? Yes, as described above. ## Tests - `packages/lint/src/authored-site-expression.test.ts` (50 → 57) - **The flow-condition table.** `warnShadowedFieldReads` moves from `pass-silent-here` to `pass`. Its fixture now carries `variables`, and the entry is pinned equal to the runtime gate at the start, `decision` and edge slots of a hand-written flow that declares the same variables (+2 slot cases). - **New block `with the flow's declared variables (objectstack-ai#33176)`** (+5): - the probe declares the variables as handed, and has no `variables` key without them; - CONTROL: without variables the gate and the entry both say nothing; - a variable that shadows no field gets no warning; - only the bare read is warned, and `record.title` is not; - every trigger kind, and a condition after a start condition, answers as the gate. - `packages/mcp/src/mcp-validate-expression.test.ts` (72 → 77) - (a) Variable `title` shadows the text field `title`, read bare in `title * 2 > 10`. The tool's whole verdict, validator half included, equals the gate's verdict on a flow declaring it: one shadowed-read warning, no errors, `ok: true`. The finding names `title` and `gp_req`. - (b) CONTROL, the same call without `variables`: `ok: false` with `type-mismatch-run-fails`, the bare name typed as the field, equal to the definition-less bridge's answer. - The warning is the gate's after a `startCondition` too. - (d) A variable that shadows no field (`threshold`) gets `[true, [], []]`, as at the gate. - The spec's own variable refusals: a missing `type`, `$record`, the alias `input`. - (c) The refusal table gains three rows: `variables` at `validation`, at `template` and at the default site. - `packages/mcp/src/mcp-stdio-tools.test.ts` (18 → 20): the same `variables` input schema is advertised on stdio and HTTP. The shadowed call, the CONTROL call and the off-site refusal each give the same `tools/call` result on both transports, and the three answers differ as the input says they should. ## Acceptance notes - **The validator half is handed the declared variables, not every name the run binds.** On a real flow the gate also leaves node ids, `screen` field names and the engine's own names (`record`, `previous`, `vars`, `current_user`) untyped. The tool is handed what the flow declares under `variables`, so a bare name that one of those others holds is still typed as the field here. The gate's shadowed-read warning reads declared variables only, so that warning is exact. - **`type` is required by the spec's shape and read by neither half**, the same as at the gate. - **Ruling grep** (`ruling|Ruling-ref|maintainer|⛔|objectstack-ai#33147|objectstack-ai#32872`) in the touched functions: - `authored-site-expression.ts`: one binding line, "⛔ Nothing here re-implements a pass", which this change keeps. Every other hit is a provenance tag. - The `validate_expression` handler and `gatePassFindings` in `mcp-http-tools.ts`: no ruling, maintainer or ⛔ line, and 10 provenance tags. - No maintainer ruling on objectstack-ai#33176. - **Serial constraint with objectstack-ai#33205** (draft, objectstack-ai#33154). I read its diff at head `9d07ffa0`. It touches `authored-site-expression.test.ts` at lines 103–153 (`walkPushes`, `CYCLE`) and `validate-expressions.ts`. This PR touches that test file only at lines 455–780 and does not touch `validate-expressions.ts`, so no hunk is shared. - The header of `authored-site-expression.ts` said the shadowed-read warning never fires through the entry. It now says the warning fires when the variables are given, and does not fire, as before, when they are not. ## Verification Head `4cae1f45ab` (`origin/main` `295ce127` plus two commits). Every reading below was taken at that head. <details><summary>Package suites, typecheck and lint</summary> ``` os-verify-lock: pnpm --filter @objectstack/lint --filter @objectstack/mcp run test packages/lint test: Test Files 208 passed (208) Tests 8877 passed (8877) packages/mcp test: Test Files 64 passed (64) Tests 1174 passed (1174) VERDICT command-exit 0 os-verify-lock: pnpm --filter @objectstack/lint --filter @objectstack/mcp run typecheck packages/lint typecheck$ tsc --noEmit && pnpm check:test-typecheck packages/mcp typecheck$ tsc --noEmit && pnpm check:test-typecheck VERDICT command-exit 0 pnpm lint (eslint . --no-inline-config) :: exit 0 ``` </details> <details><summary>Ablations (each through scripts/ablation-replace.mjs; each restored with blob == HEAD and git diff HEAD empty)</summary> ``` L1 lint: the probe declares no variables (the `variables` spread in authoredFlowProbe deleted) lint suite reads src: 6 failed | 51 passed (57) — the 3 warnShadowedFieldReads slot cases, the probe read-back, the bare-read-only case, the trigger-kind/start-condition case A1 mcp: the validator hint loses `flowVariables` 1 failed | 96 passed (97) — "given the flow's variables, a bare read of one is the variable" A2 mcp: `variables` not handed to the gate 3 failed | 94 passed (97) — the whole-verdict pin, the start-condition pin, the stdio parity pin A3 first attempt void: deleting the `if` line alone left a syntax error, no tests ran. Re-done as A3b: A3b mcp: the off-site refusal disabled (`if (false)`) 2 failed | 95 passed (97) — the refusal table, the stdio parity pin ``` The MCP suites read `@objectstack/lint` through its `dist/` (no vitest alias). L1 was read on the lint suite, which imports `src`. The MCP leg of the probe is covered by A2. </details> <details><summary>Derived gate families (dispatch-gates --commands, 67 families; --ran reconciliation)</summary> ``` dispatch-gates: gate list derived from the tree of 'objectstack-ai/objectstack' at commit 4cae1f4 65 families :: exit 0 pnpm check:dual-build-cjs-loads :: exit 3 PREREQUISITE NOT MET (no full build here) — NOT MEASURED, CI's Lint & Repo Gates runs it pnpm check:lean-entry-closure :: exit 3 PREREQUISITE NOT MET (objectql dist absent) — NOT MEASURED, same ✓ dispatch-gates --ran: 67 derived famil(ies) accounted for — 65 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3). ``` `test:repo` and the full farm are CI's. No export was renamed or removed, so `check-platform-checklist` is not owed. Full dogfood is not owed: the title has no `!` and the Clause-② arm is `(widening)`. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_017xRBcSZ51q2s3nMfakhdJ3)_ <!-- signed: domain:server#7 · sunhaolin · session_017xRBcSZ51q2s3nMfakhdJ3 --> --------- Co-authored-by: Claude <noreply@anthropic.com>
…one-hop leaf through an extension-added lookup, and the regex and JSON-schema checks of an extension's validation rules (objectstack-ai#33398) <!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XHefYE81B7Uddo8xCtrke3d)_ Fixes objectstack-ai#33216 Fixes objectstack-ai#33217 Clause-②: no (narrowing) — `os build`, `os validate`, `os lint` and the runtime `object_extension` publish door (Studio, `PUT /api/v1/meta/object_extension/TARGET`, the MCP and AI authoring doors) now refuse two shapes an object extension could carry before: a validation rule or formula reading `record.REF.LEAF` through a lookup an extension adds where the lookup's target serves no `LEAF`, and a `format` / `json_schema` validation rule an extension adds whose regex or schema does not compile or names an unregistered format. No exported type or signature changes. Measured first-party exposure: 0 `objectExtensions` entries add a lookup or a validation rule (`examples/app-showcase` one entry, three plain fields; `packages/plugins/plugin-auth` one, a `secret` field; HotCRM `origin/main` ac4dd3d has no `objectExtensions` in code), so nothing first-party is newly refused. Metadata-protocol: narrowed Skills-docs: none owed — this PR edits `content/docs/deployment/validating-metadata.mdx` (the rule-table row marks the extension door, and the object extension paragraph names both checks); `skills/objectstack-data` teaches one-hop reads, `format` / `json_schema` rules and `defineObjectExtension({ extend, fields })` without saying an extension is exempt from either check, so the build and the door now give the verdict the object's own declarations already get. Precedent followed: objectstack-ai#33154 (PR objectstack-ai#33205), which built the extension walk these two cards extend and declared the same `no (narrowing)` / `narrowed` pair. ## 维护者速读 - **改了什么**:对象扩展(`objectExtensions` / Studio 发布的 `object_extension`)补上两项对象自身早已有的检查。① 通过“扩展新增的查找字段”做一跳读取(`record.manager__c.字段`)时,目标字段名现在按“对象实际提供的结构”判定,拼错即拒,和通过对象自身声明的查找字段一样(同一规则 id `expression-invalid`、同一句提示)。② 扩展里 `format` 规则的正则、`json_schema` 规则的 schema 及其 format 名,现在和对象自身规则一样检查(同三个规则 id),位置为 `object '对象' · objectExtensions[0] · validation '规则'`。两项在 `os build` 与运行时发布口结论一致。 - **为什么改**:注册表把扩展字段和扩展校验规则合并到目标对象上,每次保存都会执行;此前拼错的一跳字段让公式恒为空、让校验规则拒绝每次保存,写错的正则或 schema 则在每次写入时被跳过,规则形同虚设,都要等最终用户保存时才暴露。 - **风险与回滚**:收窄;第一方实测 0 处扩展新增查找字段或校验规则,无既有元数据被新拒。对象自身的规则、公式与一跳读取的位置和结论不变;草稿保存不受影响,已存的行再次发布时才判。回滚即 revert。 - **先看**:`packages/lint/src/validate-expressions.ts`(`refuseUndeclaredHopField` 与 `storedMetadataBodyReferencesFor` 改读 `typedObjects`)、`packages/lint/src/validate-rule-compilability.ts`(`walkObjectValidationRules` 新增的扩展循环)、`packages/lint/src/authoring-rules.ts`(两条规则的 `runtimeTypes` 加 `object_extension`)。 - **两分钟验证**:`pnpm --filter @objectstack/lint exec vitest run src/runtime-gate.object-formula-writes.test.ts src/validate-rule-compilability.test.ts -t "33216|33217"`,预期 16 条全过:扩展查找字段后拼错的叶子字段、扩展的坏正则/坏 schema/拼错的 format 名在 build 与发布口都被拒且结论逐条相同,正确写法通过,对象自身的用例不变。 - **需要你做的**:无,席位落地。 ## What changes Two commits, one per card. **objectstack-ai#33216 — `packages/lint/src/validate-expressions.ts` (hop-index region only).** - `refuseUndeclaredHopField` looked the hopping reference up on the declared `objects`, so a lookup an `objectExtensions` entry adds was never found and its leaf never judged. It now reads `typedObjects`, the served fold objectstack-ai#30471 already builds (every extension field folded in, a field two packages tie on left out), the same fold `fieldIndex` reads for the leaf. A hop through a declared lookup reads the same definition as before, so the object's own verdicts and locations do not move. - `storedMetadataBodyReferencesFor` takes a `served` flag. The hop refusal (`refuseStoredMetadataBodyHop`) asks for the served reading, so a hop through an added lookup into a stored-metadata-body table is refused as through a declared one. The object walk's objectstack-ai#24677 field-reference verdict keeps the declared reading, so a field an extension adds is never charged to the object's own location. One map holds both readings (a served reading is keyed `served:NAME`), so the objectstack-ai#5017 receiver scan sees no new receiver. - Both sites serve the build and every door that runs the expression passes; at the `object_extension` door the written entry is folded into the door's live objects by the same fold, so the verdict is the build's. - `packages/spec/src/migrations/entries/semantic/18.object-extension-added-lookup-hop-leaf-judged.ts`: the ADR-0087 D3 entry. No D2 conversion: which field the author meant is a fact only the author holds. **objectstack-ai#33217 — `packages/lint/src/validate-rule-compilability.ts`, `validate-rule-schema-formats.ts`, `authoring-rules.ts`.** - `walkObjectValidationRules` (the one walk both rules share, so they cannot disagree about which rules exist) also walks each rule an extension adds, through `objectExtensionsByTarget` (the fold objectstack-ai#33205's extension walk reads: one entry per package per target, as the registry keeps them), `conditional` branches flattened in. Located at the entry: `where` `object 'T' · objectExtensions[i] · validation 'N'` (the locus objectstack-ai#33205 uses), `path` `objectExtensions[i].validations.N.regex` / `.schema` (the entry's path in place of the object's `objects.T`), `packages[j].manifest.` prefixed in a built artifact. The rule ids are unchanged. An undeclared target is judged all the same: a regex or schema needs no field of the target. - `validateRuleCompilability` and `validateRuleSchemaFormats` cross onto the `object_extension` door (`runtimeTypes: ['object', 'object_extension']`), together, as their objectstack-ai#7220 family discipline requires. On that write the snapshot carries the written entry as its sole extension; the target's own rules the door's live objects carry are judged in the gate's baseline as well, so the differential charges the write with its entry's findings only. - `packages/spec/src/migrations/entries/semantic/18.object-extension-validation-rule-artifacts-judged.ts`: the ADR-0087 D3 entry. - `content/docs/deployment/validating-metadata.mdx`: the "Declared enforcement that cannot run, declared on the object being written" row's runtime column now reads `✓ᵒᵒˣ`, and the object extension paragraph names both checks. Both statements were made false by this change (os-dev rule 4). - `.changeset/33216-extension-lookup-hop-and-rule-artifacts.md`: `@objectstack/lint` minor and `@objectstack/spec` minor, both declaration lines, a BREAKING banner (Before / Now / Unchanged / Fix) and `adr-0087: registered` naming both entries. ## Tests 1. **`packages/lint/src/runtime-gate.object-formula-writes.test.ts`**, new describe `objectstack-ai#33216` (7 cases), at the real gate (`runRuntimeAuthoringRules`) and the build (`runAuthoringRules('build', …)`): - LIT: a rule reading `record.manager__c.daly_hours` through the added lookup is refused at the door at `objectExtensions[0].validations[0].then.condition`, the build's findings deep-equal the door's, and the message equals the declared-lookup case's with the reference name taken out. - LIT: the same for a formula field the extension adds. - LIT: the object's OWN formula reading through a lookup a package's extension adds is refused at the build, at the object; its control (the declared leaf) is clean. - LIT: a hop through an added lookup to `sys_metadata` is refused as a stored-metadata-body hop. - CONTROL: the correct leaf through the added lookup is clean at both doors, rule and formula. - A lookup two packages add at the same priority is left unjudged. - CONTROL: the object's own hop through a declared lookup is refused at the object save door and the build, at its own location, as before. 2. **`packages/lint/src/validate-rule-compilability.test.ts`**, new describe `objectstack-ai#33217` (9 cases): both rules on both doors; an invalid regex, an uncompilable schema and a misspelt format name an extension adds each refused at the build with rule id, `where` and `path`; each refused at the door with the build's finding byte for byte; a `conditional` branch located at the branch; the same rule ids as the object's own (whose locations are pinned unchanged); valid rules clean at both; a sibling package's entry located at its body and an undeclared target judged; the target's own broken rule not charged to the extension write; the object save door unchanged. 3. **`packages/runtime/src/domains/meta-object-extension-item.test.ts`**, through the real `saveMetaItem` + `publishMetaItem`: `[objectstack-ai#33216]` 4 cases (rule and formula: a misspelt leaf through the added lookup gets 422 `INVALID_METADATA` with the build's rule id, location and path, the field is not served and the row stays a draft; the correct leaf publishes and is served); `[objectstack-ai#33217]` 3 cases (an invalid regex and an uncompilable schema each get 422 with the build's rule id and locator, the rule is not served; valid ones publish and are served). 4. **Roster pins moved with objectstack-ai#33217** (each lists the `object_extension` door's rules exactly): two in `runtime-gate.object-formula-writes.test.ts` (objectstack-ai#33072), two in `validate-security-posture.runtime-surface.test.ts` (objectstack-ai#31998; surface amendment 6881180427). **Ablations** (one-shot, nothing permanent; each through `node scripts/ablation-replace.mjs` on the committed head, then `pnpm --filter @objectstack/lint build`, then `ablation-dist-preflight` found the marker in 4 built files; runtime pins read lint through `dist/`): - A1, the served hop reference (`for (const obj of typedObjects)` → declared `objects`): lint 3 of 94 red, runtime 2 of 40 red, exactly the five objectstack-ai#33216 LIT cases (rule and formula at both doors, the object's own formula); every control green. - A1b, the served stored-metadata-body reading (`storedMetadataBodyReferencesFor(objectName, true)` → declared): lint 1 red, the stored-metadata-body LIT; runtime 40/40. - A2a, the extension loop of the shared walk (entries filtered to none): lint 6 red (the five objectstack-ai#33217 build and door LITs and the sibling case, plus the objectstack-ai#5096 receiver meta-test, which reds on the marker's own `entries.filter` spelling, not on behaviour), runtime 2 red (the regex and schema door LITs); the controls, the differential case and the object door green. - A2b, the door crossing (`validateRuleCompilability`'s `runtimeTypes` back to `['object']`): lint 7 red (the door LITs, the roster pins, the `rulesRun` controls), runtime 2 red (the door LITs). - Restore after each: the blob equals HEAD and `git diff HEAD` is empty (the tool's verdict). Lint was rebuilt after the last leg; no marker remains in `packages/lint/dist` (`grep` 0 files for each of the four) and `git status --porcelain` is empty. ## Acceptance notes - **Exposure measured:** `git grep` of `objectExtensions` / `defineObjectExtension` over `examples/`, `packages/` (non-test) and HotCRM `origin/main`: two entries, neither adds a lookup or a validation rule. Every test file in `packages/metadata-protocol` (7 files, 251 tests) and `packages/runtime` (7 files, 136 tests) that publishes or reads an `object_extension` passes at the head. - **Not changed, by the order's fence:** the null-guard index (`buildNullableFieldIndex`) and the `extensionWrite` strip, which are objectstack-ai#33246's; objectstack-ai#33153 (a formula cycle an extension adds) and objectstack-ai#33101 are not folded. - **A reference an extension redeclares on the target** (the same field name, a different `reference`) is now read as served at a hop site, which is what the engine plans. The object walk's own field-reference verdict still reads the declared field, so such a field is not charged to the object's location. - **Boot-registered module packages** (`defineStack({ objectExtensions })` through `registerApp`) are not gated, as an object's own rules are not. ## Verification Head `d190a7f0` (base `87330e89`); `git diff --stat 87330e8 origin/main` over every touched file is empty at hand-over time, so no merge was needed. <details><summary>Package tests</summary> - `@objectstack/lint`: 208/208 files, 8902/8902 tests; typecheck exit 0. - Runtime door files (`meta-object-extension-item.test.ts` + `packages-disable-module-extension-fields.test.ts`): 81/81. - Every other test file that publishes an `object_extension`: `@objectstack/metadata-protocol` 7 files 251/251; `@objectstack/runtime` 7 files 136/136. </details> <details><summary>Gates (dispatch-gates --commands, 109 lines)</summary> The derivation at `d190a7f0` is 109 lines. Every line ran with stdin closed and its exit code captured before any pipe. 107 exited 0 on the first pass. Two exited 3 (refused, nothing measured) on a missing build: `pnpm --filter @objectstack/spec run check:skill-examples` (no `@objectstack/client-react` dist) and `pnpm check:dual-build-cjs-loads` (needs every package's dist). After a whole-repo `pnpm build` both exited 0. `dispatch-gates --ran`: `109 derived, 109 run, 0 NOT-MEASURED, 0 UNRUN`. The record is `pm-orders/spec/33216-gates-ran.txt` in the project share. </details> Dogfood (the title carries `!` and `Clause-②:` the `(narrowing)` arm): full battery, the CI command (`pnpm --filter @objectstack/dogfood test` under the verify lock), no shard, on head `d190a7f0` after a whole-repo build. Result: `VERDICT command-exit 0`, Test Files 464 passed and 3 skipped (467), Tests 3927 passed and 42 skipped (3969), no failures. --- _Generated by [Claude Code](https://claude.ai/code/session_01FEkQ5ny58hH1bcw97uPpgu)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
…d on the current row's created_at and updated_at in an ordering comparison (objectstack-ai#33434) <!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1X7LTHigm6QKzQQKhVRzksVQ)_ Fixes objectstack-ai#33246 Clause-②: yes (widening) — the flow and hook publish doors (Studio, `/api/v1/meta`, the MCP and AI authoring doors) now accept a condition they refused and `os build` accepted: `created_at` or `updated_at` (as the registry injects them, on an object whose storage the platform provisions) read off the current row (bare in a flow, or `record.`) as an operand of `<`, `<=`, `>` or `>=` with no `!= null` guard, in a record-triggered flow or in a hook whose every event is `afterInsert`, `beforeUpdate`, `afterUpdate`, `beforeDelete` or `afterDelete`. Nothing that published before is refused, and no other verdict moves: arithmetic over either column, a `previous.` read, a `beforeInsert` or read-event hook, and the other six injected columns keep their verdicts (measured below). `os build`, `os validate`, `os lint` and MCP `validate_expression` are unchanged. No exported type or signature changes. Metadata-protocol: added Skills-docs: none owed — no skill teaches that `created_at` or `updated_at` needs a null guard in a flow or hook condition, or that the door refuses one; the door now gives the verdict `os build` already gives on those two columns under an ordering comparison. Precedent followed: objectstack-ai#33154 (PR objectstack-ai#33205) for the door-versus-build reading. Round 2 answered contract review 6884221427 under seat rulings 6884227999 (F1, F2, F3, N2; N1 declarations kept). Round 3 answered delta review 6884875891 under seat rulings 6884884180 (M1, S1, N3, N4, N5). Round 4 answers review 6885550922 under seat rulings 6885555312 (M2, S2, N6). ## 维护者速读 - **改了什么**:运行时发布口(流、钩子)做“空值守卫”判定时,`created_at`、`updated_at` 作为比较运算(`<` `<=` `>` `>=`)的操作数不再报可空;仅限当前记录的这两列(流里的裸名或 `record.`,不含 `previous.`)、平台自己注入的定义、对象的存储由平台建表(外部对象不算),且钩子的每个事件都在 `afterInsert`、`beforeUpdate`、`afterUpdate`、`beforeDelete`、`afterDelete` 之内。算术运算(`+ - * / %`)、`previous.` 读取照旧判定;其它六个注入列(`owner_id`、`created_by`、`updated_by`、`owning_business_unit_id`、`queue`、`organization_id`)照旧按可空判定;所有注入列的类型判定照旧。 - **为什么改**:在 Studio 发布记录触发流或钩子时,条件 `record.created_at > timestamp(...)` 没加空值守卫会被发布口拒绝(422),而 `os build` 通过、MCP `validate_expression` 也说没问题。平台在 `beforeInsert`(`sys_stamp_audit_insert`,优先级 10)里给每条记录写这两列,之后读到的都有值,拒绝是误报。 - **风险与回滚**:放宽,只影响流和钩子发布口对这两列在比较运算中的空值判定。不变且有测试钉住的:流里 `record.created_at + 1 > 0` 与 `record.updated_at - record.created_at > duration('1h')` 照旧拒绝;`beforeInsert` 钩子照旧拒绝(可能先于平台写入运行);读事件(`beforeFind`、`afterFind`)钩子照旧拒绝(没有记录);`afterInsert` 钩子或新建流里的 `record.updated_at > previous.updated_at` 照旧拒绝(新建时 `previous` 为空);其它六个注入列、作者自己声明的 `created_at`、外部对象照旧。发布口与 build 在六列及 `beforeInsert`、读事件钩子上的差异留给 objectstack-ai#33435。回滚即 revert。 - **先看**:`packages/lint/src/validate-expressions.ts`(`PLATFORM_STAMPED_COLUMNS`、`isPlatformStampedColumn`、`buildPlatformStampedIndex`、`isStampedComparisonFinding`、`hookReadsStampedRow`)、`packages/runtime/src/domains/meta-flow-hook-injected-column-null-guard.test.ts`(真实发布口)、`packages/lint/src/validate-expressions.flow-null-guards.test.ts`(objectstack-ai#33246 一节)。 - **两分钟验证**:`pnpm --filter @objectstack/lint exec vitest run src/validate-expressions.flow-null-guards.test.ts -t 33246`,预期 10 条全过:两列无守卫比较在流三处与钩子都通过;五个可空注入列照旧拒绝;日期运算照旧拒绝(钩子、流裸写、动作);流里 `record.` 写法的算术照旧拒绝;`beforeInsert` 钩子照旧拒绝;`previous.` 读取照旧拒绝;读事件钩子照旧拒绝;作者声明与外部对象的 `created_at` 照旧判定;声明的可空字段照旧拒绝。 - **需要你做的**:无,席位落地。 ## What changes - **`packages/lint/src/validate-expressions.ts`.** - `PLATFORM_STAMPED_COLUMNS` (`created_at`, `updated_at`) and `isPlatformStampedColumn(obj, field, def)`: true only when the field is one of the two, its definition is the platform's own (`isInjectedColumnDefinition` against `injectedSystemColumnDefs(obj)`), and the platform provisions the object's storage (`platformProvisionsStorage`, so not an ADR-0015 `external` object). The two names are the ones `@objectstack/objectql` stamps on every row (`sys_stamp_audit_insert`, a `beforeInsert` hook at priority 10, writes both unconditionally). This package may not import a runtime, so they are spelled here, with that reference in the docblock. - `buildPlatformStampedIndex(objects)` (object → its stamped columns) is built on every runtime write (`options.runtimeWriteType !== undefined`); the build gets an empty index. `buildNullableFieldIndex` is back to `main`'s signature and body: the nullable index still holds both columns. - `checkNullGuards` takes `{ stampedComparisons }` (default `true`) and drops a finding only when `isStampedComparisonFinding` holds: the operand is a stamped column of that object read off the current row (bare, as a record-triggered flow flattens its trigger record, or `record.<column>`), and the operator is `<`, `<=`, `>` or `>=`. A `previous.<column>` operand keeps its finding and `PREVIOUS_GUARD_CLAUSE` (M2): an insert binds `previous` itself to `null`. An arithmetic operand (`+ - * / %`) keeps its finding (M1): at a record-triggered flow's `record.` read the null guard is the door's only refusal of date arithmetic, because the flattened site type-checks only the bare spelling. - The hook loop passes `stampedComparisons: hookReadsStampedRow(hook.events)`: true only when `events` is a non-empty list and every event is `afterInsert`, `beforeUpdate`, `afterUpdate`, `beforeDelete` or `afterDelete`. A `beforeInsert` hook (S1) can run before the stamp, at any `priority`, and read either column as `null`; a `beforeFind` / `afterFind` hook (S2) carries no record. - The `object_extension` strip is `main`'s (only that write reads the objects stripped). Every other door keeps the served objects, so `fieldTypeIndex` and every other reader still see the injected columns' types. - Effect at the door: an unguarded ordering over `created_at` / `updated_at` at the three record-triggered flow sites and in a hook condition whose every event reads a stamped stored row publishes, when the read is the current row's. Everything else is judged as on `main`. - **`packages/lint/src/validate-expressions.test.ts`**: the objectstack-ai#5017 declared-key meta-test's `hook` row now lists `events` (a declared `ObjectStackSchema.hooks[]` key), and its plumbing set names `platformStampedIndex` / `stamped` / `hookEvents` (Map / Set / Array locals). The meta-test forces that visit for any new read. - **`.changeset/33246-door-skips-stamped-timestamps-in-comparisons.md`** (renamed from round 1's `33246-door-reads-objects-as-authored.md`): `@objectstack/lint` minor, both declaration lines, Before / Now / Unchanged. Unchanged names arithmetic at every door (the flow `record.` spelling included), the author-declared and `external` `created_at`, a `previous.` read, a `beforeInsert` or read-event hook, the six injected columns still judged nullable (`organization_id` included), and the door/build difference on those six and on a `beforeInsert` or read-event hook until objectstack-ai#33435. Its Now paragraph gives the stamp as the warrant (N6). - `content/docs/deployment/validating-metadata.mdx` does not describe the door's null-guard reading, so it is not edited. ## Tests 1. **`packages/lint/src/validate-expressions.flow-null-guards.test.ts`**, top-level describe `objectstack-ai#33246` (10 cases), at the gate (`runRuntimeAuthoringRules`, the account as the registry serves it via `applyInjectedSystemColumns`) and at the build (`runAuthoringRules('build', …)`). Five writes per condition: a flow with it at the start node, an edge and a `decision` branch; a hook on `'crm_account'` and on `['crm_account']`. - The served account declares the injected columns. - LIT: `record.created_at > timestamp('2025-01-01T00:00:00Z')` and `record.updated_at > record.created_at`: no expression finding at the door or the build. - LIT: `record.COLUMN > 'a'` for each of `owner_id`, `created_by`, `updated_by`, `owning_business_unit_id`, `queue`: one null-guard finding naming the column at the door. - LIT (type verdict): `record.created_at + 1 > 0` and `record.updated_at - record.created_at > duration('1h')` at a hook, bare `created_at + 1 > 0` at a flow start and edge, and `record.created_at + 1 > 0` as an action `visible`: each refused with `date arithmetic`. - LIT (M1): `record.created_at + 1 > 0` and `record.updated_at - record.created_at > duration('1h')` at a flow start condition: each refused with a null-guard finding on the column. - LIT (S1): `record.created_at > timestamp(…)` on a hook with `events: ['beforeInsert']` and `['beforeInsert', 'beforeUpdate']`, on a string and a list `object`: refused with a null-guard finding; the same condition on an `afterInsert` hook: no finding. - LIT (M2): `record.updated_at > previous.updated_at` in an `afterInsert` hook and at a `record-after-create` flow start: one finding each, on `previous.updated_at`, whose message names `previous != null && previous.updated_at != null`. - LIT (S2): `record.created_at > timestamp(…)` on a hook with `events` `['beforeFind']`, `['afterFind']` and `['afterFind', 'afterUpdate']`: refused with a null-guard finding. - CONTROL: a `created_at` the author declares (own label) is judged at the door as at the build (deep-equal findings); the one on an `external` object is still judged at the door. - CONTROL: `record.amount > 0` (declared nullable) refused at the door with one finding, deep-equal to the build's. 2. **`packages/runtime/src/domains/meta-flow-hook-injected-column-null-guard.test.ts`** (new; surface amendment 6884227999), the real door: better-sqlite3 behind the real `ObjectQL`, the real `sys_metadata*` objects and `ObjectStackProtocolImplementation`, the account registered through `registerApp`, each item saved as a draft in a writable package and published through `publishMetaItem` (6 cases): - The registry serves the account with `created_at`, `updated_at`, `owner_id`, `created_by` declared `required: false`; a system-context insert stores both timestamps and `null` in `owner_id` and `created_by`. - LIT, flow and hook: both `created_at` / `updated_at` conditions publish (row `active`), and `os build` reports nothing on the same item. - LIT, flow and hook: `record.owner_id > 'a'` gets 422 `INVALID_METADATA` with one `expression-invalid` issue naming `record.owner_id`; the row stays `draft`. - LIT (S1): a `beforeInsert` hook with `record.created_at > timestamp(…)` gets 422 `INVALID_METADATA` with one `expression-invalid` issue naming `record.created_at`; the row stays `draft`. 3. **Ablations** (one-shot; nothing permanent; each through `node scripts/ablation-replace.mjs`, restore verified blob == HEAD and `git diff HEAD` empty): - Round 4, at `df63888d` (lint `objectstack-ai#33246` 10 cases): - M2, the current-row test off (`finding.operand === finding.field || finding.operand === 'record.' + finding.field` replaced by an always-true opaque guard): lint 1 of 10 red, the M2 LIT; a throwaway probe (deleted) split it per site: the `afterInsert` hook and the `record-after-create` flow each red. - S2, `beforeFind` / `afterFind` added to `STAMPED_ROW_HOOK_EVENTS`: lint 1 of 10 red, the S2 LIT. - S1 again on the new mechanism, `beforeInsert` added to `STAMPED_ROW_HOOK_EVENTS`: lint 1 of 10 red, the S1 LIT. - Round 3, at `efc8003b`: - M1, the skip on arithmetic operands too (`STAMPED_COMPARISON_OPERATORS.has(finding.operator)` replaced by an always-true opaque guard): lint 1 of 8 `objectstack-ai#33246` cases red, the M1 LIT. - S1, the `beforeInsert` exception off (`includes('beforeInsert')` → `includes('ABL_33246S1')`): lint 1 of 8 red, the S1 LIT; runtime, after `pnpm --filter @objectstack/lint build` and `ablation-dist-preflight` finding the marker in `dist/`, 1 of 6 red, the S1 LIT. Lint rebuilt after restore; `ablation-dist-preflight --absent` passes on all 20 built files with a clean tree. - Round 2, at `ddd834f5` (6 `objectstack-ai#33246` lint cases then, 5 runtime cases): - A, `main`'s reading (the stamped skip guarded off by an opaque global): lint 1 of 6 red (the created_at / updated_at LIT); runtime via `dist/` 2 of 5 red (the flow and hook LIT). - B, the round-1 reading (strip on every runtime write): lint 3 of 6 red (the five-column LIT, the date-arithmetic LIT, the external CONTROL). ## Measurement Round 1's probe (deleted, not committed) over the real door at `origin/main` `fc283d6d`: | Condition | Site | Door on `main` | `os build` (real CLI) | `validate_expression` gate half | Door at this head | | :--- | :--- | :--- | :--- | :--- | :--- | | `record.created_at > timestamp('2025-01-01T00:00:00Z')` | flow start / edge / branch, hook (every event a stamped-row event) | 422 `expression-invalid` (nullable `created_at`) | exit 0 | clean | published | | `record.updated_at > record.created_at` | flow start / edge / branch, hook (every event a stamped-row event) | 422, two findings | exit 0 | clean | published | | `record.created_at > timestamp(…)` | `beforeInsert` hook | 422 | accepted | clean | 422, unchanged (objectstack-ai#33435) | | `record.created_at > timestamp(…)` | `beforeFind` / `afterFind` hook | 422 | accepted | clean | 422, unchanged | | `record.updated_at > previous.updated_at` | `afterInsert` hook, `record-after-create` flow | 422 (`previous.updated_at`) | accepted | — | 422, unchanged | | `record.owner_id > 'a'` | flow, hook | 422 (nullable `owner_id`) | exit 0 | clean | 422, unchanged (objectstack-ai#33435) | | `record.created_at + 1 > 0` | hook, action | 422 `date arithmetic` | accepted (`runAuthoringRules('build')`: no type for an injected column) | — | 422, unchanged | | `record.created_at + 1 > 0` | flow start | 422 (nullable `created_at`) | accepted | — | 422, unchanged | | `record.amount > 0` (control) | flow edge, hook | 422 | exit 1, the same finding | finding | 422, unchanged | - `os build` is the real CLI (`packages/cli/bin/run.js build`) on a `defineStack` config with the same object, flows and hooks. `os lint` on it exits 0. The `beforeInsert`, read-event, `previous.` and flow-arithmetic build rows are `runAuthoringRules('build')`, which judges no injected column. - `validate_expression`'s gate half is `judgeAuthoredSiteExpression` (site `flow_condition`) over the served definition, the call the MCP tool makes; it strips the injected columns, so it stays as it was. - Engine fact: a system-context insert stores `created_at` and `updated_at` and `null` in `owner_id`, `created_by`, `updated_by`, `owning_business_unit_id`, `queue` (pinned in the runtime file for `owner_id` and `created_by`). `organization_id`'s injected definition says org scoping stamps it on insert; the door still judges it nullable, as on `main`. ## Acceptance notes - **Door versus build, still split:** the door judges `owner_id`, `created_by`, `updated_by`, `owning_business_unit_id`, `queue` and `organization_id` nullable, and judges `created_at` / `updated_at` in a `beforeInsert` or read-event hook; the build judges no injected column. objectstack-ai#33435 owns that verdict; the changeset says so. - **Type verdicts:** the build's type index has no injected column (`dyn`), the door's has them. Unchanged by this PR. - A record-triggered flow's `record.created_at + 1 > 0` is not type-checked at the door on `main` or here (only the bare spelling is); the null guard refuses it, on `main` and here (M1). - A flow on `record-before-create` binds a `beforeInsert` hook at the default priority (100), after the stamp (10), so the flow sites are not excepted. - The door has no general gate against a `record.` read in a read-event hook condition (the engine rejects such a read at run time, objectstack-ai#4775); S2 only keeps this PR's skip off those hooks. Reported to the seat for a card. - **Out of scope, unchanged:** a hop leaf through an injected lookup (`record.owner_id.nmae`) is judged at neither door. ## Verification Head `df63888d` (round 3 `10f6d63a`, round 2 `ddd834f5`, round 1 `533eb60b`; base `fc283d6d`). Round 4 pushes one commit on the same branch, no rebase, no merge: `git diff --stat fc283d6 origin/main` (`e3f0cfd4` at hand-over) over every touched file is empty, and `git merge-tree` with `origin/main` is clean. Everything below ran at `df63888d`. <details><summary>Package tests</summary> - `@objectstack/lint`: 210/210 files, 8981/8981 tests. Typecheck (`tsc --noEmit && check:test-typecheck`) exit 0. - `@objectstack/runtime`: the door file 6/6; typecheck (`tsc --noEmit && check:test-typecheck`) exit 0. - `@objectstack/metadata-protocol` (every save, draft-diagnostics and publish door test, lint read through `dist/` rebuilt at this head): 339 files passed, 9 skipped; 22850 tests passed, 43 skipped. </details> <details><summary>Gates (dispatch-gates --commands, 63 lines)</summary> Every line ran with stdin closed and its exit code captured before any pipe. All 63 exited 0 (`check:dual-build-cjs-loads` included). `dispatch-gates --ran`: 63 derived, 63 run, 0 NOT-MEASURED, 0 UNRUN. </details> Dogfood: not run. The title carries no `!` and `Clause-②` carries no `(narrowing)` arm. --- _Generated by [Claude Code](https://claude.ai/code/session_01FEkQ5mnBkyQ4d2mXNVg3Fd)_ <!-- signed: domain:spec#1 · os-project-manager · session_01FEkQ5mswnWm181XgYcCUag --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Tesla · project thread
Fixes #33154
Clause-②: no (narrowing) —
os build,os validate,os lintand the runtimeobject_extensionpublish door (Studio,PUT /api/v1/meta/object_extension/TARGET, the MCP and AI authoring doors) now refuse an extension whose validation rule carries aconditionorwhenthat the same rule declared on the object is refused for. No exported type or signature changes. Measured first-party exposure: 0 extension entries carry a validation rule (examples/app-showcaseandpackages/plugins/plugin-authextensions add fields only; HotCRMorigin/main92519d8 has noobjectExtensionsin code), so nothing first-party is newly refused. Two repository test fixtures carried the refused shape and are repaired here (see Acceptance notes).Metadata-protocol: narrowed
Skills-docs: none owed — this PR edits
content/docs/deployment/validating-metadata.mdx(the object extension door paragraph names the rule pass);skills/objectstack-datateaches validation rules anddefineObjectExtension({ extend, fields })without saying an extension's rules are exempt, so the build and the door now give the verdict the object's own rules already get.Precedent followed: #33072 (PR #33119), which declared the same
no (narrowing)/narrowedpair for the computed fields an extension adds.维护者速读
objectExtensions/ Studio 发布的object_extension)里的validations校验规则,现在在os build和运行时发布口都按对象自身校验规则的同一套检查判定(同一个函数judgeValidationRule、同一条规则 idexpression-invalid),位置为object '对象' · objectExtensions[0] · validation '规则'。region__c,一个未加空值守卫的record.qx_credit > 5000000),已在本 PR 修正。草稿保存不受影响,已存的行再次发布时才判。回滚即 revert。packages/lint/src/validate-expressions.ts(judgeValidationRule、扩展遍历里新增的循环、扩展写入时去掉注入系统列的一行)、packages/lint/src/runtime-gate.object-formula-writes.test.ts(An object extension's validations are judged at neither the publish door nor os build, yet the registry registers them on the target object #33154 一节)、packages/runtime/src/domains/meta-object-extension-item.test.ts(真实发布口 4 条)。pnpm --filter @objectstack/lint exec vitest run src/runtime-gate.object-formula-writes.test.ts -t 33154,预期 9 条全过:拼错字段与未知函数被拒、build 与发布口结论逐条相同(含平台注入的系统列created_at:两边都接受)、合法规则与读同一扩展新增字段的规则通过。9d07ffa0),无 must-fix / should-fix,4 个 nit 记为接受的偏差;上一轮 FAIL(6870963898)的 F1、F2、N2、N3 已在树上核实解决。后续卡 A one-hop read through a lookup an object extension adds is accepted with a misspelt target field, then refuses every save #33216、An object extension's format and json_schema validation rules skip the regex and JSON-schema checks the object's own rules get #33217、A flow or hook condition ordering record.created_at with no guard is refused at the publish door while os build accepts it #33246。复审由实现本 PR 的同一会话采纳隔离子代理的结论,依据维护者 2026-11-14 14:17Z「你现在可以自己契约复审了」。非受管面,579 行。What changes
Lint: one rule pass, two walks.
packages/lint/src/validate-expressions.ts.judgeValidationRule(rule, { objectName, locus, rulePath }). It covers theconditionandwhen(with the one-hop checks the rule validator serves), every nestedthen/otherwisepredicate, theparentroot verdict and the null-guard gate. The object walk's loop now calls it, and its findings, order and key paths are byte for byte what they were.validations[]rule of each entry thatobjectExtensionsByTargetkeeps (the fold already carried them). Arecord.FIELDread resolves against the target's fields as served (fieldIndex, overobjectsAsServed), so a field this extension or a sibling package's extension adds resolves, and a field nothing serves is unknown. An undeclared target is judged on what does not depend on its fields, as its formulas are. The hop checks (refuseUndeclaredHopField,storedMetadataBodyReferencesFor) read the declared objects, so the leaf of a one-hop read through a reference an extension adds is not judged (see Acceptance notes).object 'TARGET' · objectExtensions[i] · validation 'RULE', and the key path isENTRY.validations[k].SLOT. The door's 422 carries that path as is (objectExtensions[0].validations[0].condition); only a draft read's_diagnosticsre-spell it item-relative (validations.0.condition).object_extensionwrite the door's live objects are read throughstripInjectedSystemColumns(@objectstack/metadata-core), asauthored-site-expression.tsreads served objects. The registry serves an object with the system columns it injects (created_at,owner_id, …) declared,required: falseand no default, so the null-guard gate judgedrecord.created_at > …as an unguarded nullable operand and refused at the door whatos buildaccepts. Stripped, the indexes re-derive those columns as the build does: known fields, never judged nullable.object_extensionwrite the door still runs ONE pass, the extension walk, and returns after it (lint: the object_extension publish door runs no field-formula judgment, so a computed field os build refuses still publishes through PUT /meta/object_extension #33072'sextensionWrite). The rules join that one pass.packages/lint/src/authoring-rules.ts. Comment only (surface amendment 6868654518), on the expression rule'sruntimeTypes.Docs, migration and changeset.
content/docs/deployment/validating-metadata.mdx. One sentence in the object extension door paragraph. The CEL row's columns do not change: theᵒˣmark landed with lint: the object_extension publish door runs no field-formula judgment, so a computed field os build refuses still publishes through PUT /meta/object_extension #33072.packages/spec/src/migrations/entries/semantic/18.object-extension-validation-rule-expression-judged.ts. The ADR-0087 D3 entry. Its printed guidance carries no tracker id. There is no D2 conversion, because how a refused rule is repaired is a fact only the author holds..changeset/33154-object-extension-validation-rules-judged.md.@objectstack/lintminor and@objectstack/specminor, with both declaration lines, a BREAKING banner (Before / Now / Unchanged / Fix) that names the null-guard refusal and its fix, and the ADR-0087 disposition marker.Tests
packages/lint/src/runtime-gate.object-formula-writes.test.ts, a new top-level describe#33154with 9 cases, at the real gate (runRuntimeAuthoringRules) and the build (runAuthoringRules('build', …)):thenbranch is refused at the branch.sqrt, a bare reference), the door's findings deep-equal the build's.applyInjectedSystemColumns), an unguarded ordering overrecord.created_atis accepted at the door as at the build, and one over a declared nullable field (record.amount > 0) is refused at both, the findings deep-equal.packages[2].manifest.objectExtensions[0].packages/runtime/src/domains/meta-object-extension-item.test.ts, a new describe[#33154]with 4 cases, through the realsaveMetaItem+publishMetaItem:record.nmaegets 422INVALID_METADATAwith issueexpression-invalidat the build's location and path. The rule is not served, and the row stays a draft.record.created_at > timestamp(…)with no guard publishes and is served (the account as served declarescreated_at), andos build(runAuthoringRules('build', …)on the account as authored and the same entry) reports nothing; an unguardedrecord.bonus__c > 100on a field the same entry adds is refused at both, with the same rule, location and path.meta-object-extension-item.test.ts: a bareregion__c == nullbecomesrecord.region__c == null.packages-disable-module-extension-fields.test.ts(surface amendment 6869487624): an unguardedrecord.qx_credit > 5000000gainsrecord.qx_credit != null &&.authored-site-expression.test.ts: thevalidate_expressionenumeration's source regions now read the hoisted rule pass.indexOfandisArraymoved out of the region with the object loop's own index, so they leave the member-call table.Ablation (one-shot; nothing permanent):
node scripts/ablation-replace.mjsreplaced the extension walk'sfor (const rule of rules) {with an empty loop (anchor x1 → x0, blob a3c3164d → 1bba8602). Thenpnpm --filter @objectstack/lint buildran, andablation-dist-preflightfound the marker in 4 built files.dist/: 2 of 3 red. The control stayed green.git diff HEADis empty. Lint was rebuilt, andablation-dist-preflight --absentpasses on all 20 built files with a clean tree.[] as typeof rules. The dist reading passed on that run, and the restore leg passed--source-marker.Ablation of the strip (r1, one-shot):
ablation-replace.mjsreplacedif (extensionWrite) stack = {withif (extensionWrite && String('ablated-strip') === 'off') stack = {(anchor x1 → x0, blob 72951696 → e6b23d5a). Lint was rebuilt, andablation-dist-preflightfound the marker in 4 built files.record.created_at, the build none).422onrecord.created_at).git diff HEADis empty. Lint was rebuilt, andablation-dist-preflight --absentpasses on all 20 built files with a clean tree.Acceptance notes
validate-rule-compilabilitychecks aformatrule's regex.validate-rule-schema-formatschecks ajson_schemarule's formats.obj.validations, so a regex or schema format in an extension's rule is judged at neither door. Neither is an expression pass. The changeset's Unchanged line says so.refuseUndeclaredHopFieldandstoredMetadataBodyReferencesForread the declared objects, so withmanager__c(a lookup to staff) added by the extension,record.manager__c.daly_hours > 12passes the build and the door alike (measured), while the same misspelling through a reference the target declares is refused. The changeset's Unchanged line says so. Filed as A one-hop read through a lookup an object extension adds is accepted with a misspelt target field, then refuses every save #33216.record.created_atin a record-triggered flow or a hook condition is refused at the door whileos buildaccepts it. It is out of this card's scope: those walks are not in this diff. Filed as A flow or hook condition ordering record.created_at with no guard is refused at the publish door while os build accepts it #33246.defineStack({ objectExtensions })throughregisterApp) are not gated, as an object's own rules are not.packages-disable-module-extension-fields.test.tsstill registers unguarded module rules that way, untouched.Verification
Head
9d07ffa06(rework r1 on15d074782: the strip, its pins, and the prose fixes).origin/mainwas merged twice before r1 (1169d64 before opening, then after #33168 landed onauthored-site-expression.test.ts); r1 merges nothing, andgit merge-treeagainstorigin/mainat push time is clean. Everything below ran at9d07ffa06unless it names another head.Package tests
@objectstack/lintat9d07ffa06: 208/208 files, 8879/8879 tests. Typecheck exit 0.9d07ffa06(meta-object-extension-item.test.ts+packages-disable-module-extension-fields.test.ts): 74/74.object_extension, at9d07ffa06: metadata-protocolprotocol-extension-redeclared-owner-field,protocol-stored-item-conversion.notice-name,protocol-authoring-gate.extension-write-fold,protocol.packaged-base-refusal,protocol.unknown-picklist-binding-refusal(129/129); runtimemeta-picklist-binding-door,packages-export-base-showcase-boot.integration,meta-object-extension-item-door-fit(22/22).e4ee8af8e(before r1; r1 changes only the extension door's object read and prose):@objectstack/metadata-protocol22810 tests passed,@objectstack/objectql12874,@objectstack/platform-objects1955,@objectstack/mcp1145,@objectstack/cloud-connection1206,@objectstack/plugin-approvals1632,@objectstack/service-mailbox152,@objectstack/rest8346 (332 skipped),@objectstack/cliunit 5934 and integrationtest/migrate-meta-engine-guidance.test.ts3/3,@objectstack/runtime597 files after the fixture repair.Gates (dispatch-gates --commands, 109 lines)
The derivation at
9d07ffa06is the same 109 lines as before r1. Every line ran with stdin closed and its exit code captured before any pipe. 103 exited 0 on the first pass; six@objectstack/speclines (check:api-surface,check:browser-reachable-entries,check:dual-source-exports,check:entry-nameability,check:exported-any,check:skill-examples) exited 3 (refused, nothing measured) because the spec build predated the edited semantic entry. Afterpnpm --filter @objectstack/spec buildall six exited 0.dispatch-gates --ran:109 derived, 109 run, 0 NOT-MEASURED.Dogfood (the title carries
!), full battery, the CI command, no shard, on head9d07ffa06. The closure was built first. Result:VERDICT command-exit 0, Test Files 463 passed and 3 skipped (466), Tests 3918 passed and 42 skipped (3960), no failures.Generated by Claude Code